const { defineConfig } = require('@vue/cli-service')
const path = require('path')
module.exports = defineConfig({
  transpileDependencies: true,
  devServer: {
    host: 'localhost',
    port: '6705',
    // run serve直接弹出页面
    open: true,
    proxy: {
      '/api': {
        target: 'https://www.fastmock.site/mock/f057a98211f16e40a32b924d1aa25764',
        changeOrigin: true,
        pathRewrite: {
          '^/api': '/api'
        }
      }
    }
  },
  // 设置是否在开发环境下每次保存代码时都启用 eslint验证。
  lintOnSave: false,
  // 给文件路径别名
  chainWebpack: config => {
    config.resolve.alias
      .set('@', path.join(__dirname, 'src'))
      .set('_views', path.join(__dirname, 'src/views'))
      .set('_components', path.join(__dirname, 'src/components'))
      .set('_api', path.join(__dirname, 'src/api'))
      .set('_utils', path.join(__dirname, 'src/utils'))
  }
})